let hd = {
  title: "后盾人",
  url: "houdunren.com",
  teacher: {
    name: "向军大叔"
  },
  toJSON: function() {
    return {
      title: this.title,
      teacher: this.teacher
    };
  }
};

let json = JSON.stringify(hd, null, 4);
console.log(json);
